package com.mllweb.api.service.impl;

import com.mllweb.api.core.log.Logger;
import com.mllweb.api.core.notice.email.Email;
import com.mllweb.api.core.notice.email.template.NormalEmail;
import com.mllweb.api.data.dao.EmailVitaeDao;
import com.mllweb.api.data.orm.EmailVitae;
import com.mllweb.api.service.EmailVitaeService;
import lombok.Setter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 邮件简历服务
 */
@Service
public class EmailVitaeServiceImpl implements EmailVitaeService, Logger {
    @Autowired
    private EmailVitaeDao emailVitaeDao;
    @Autowired
    private Email email;

    /**
     * 发送邮件简历
     *
     * @param emailVitae
     * @return
     */
    @Override
    public int insert(EmailVitae emailVitae) {
        StringBuffer buffer = new StringBuffer();
        buffer.append("公司："+emailVitae.getCompany());
        buffer.append("邮箱："+emailVitae.getEmail());
        buffer.append("内容："+emailVitae.getContent());
        email.send("920745848@qq.com", new NormalEmail(buffer.toString(), "有人招聘你"));
        debug("this is debug");
        error("this is error");
        return emailVitaeDao.insert(emailVitae);
    }
}
